<?php defined('In33hao') or exit('Access Invalid!'); ?>

<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>分销管理</h3>
                <h5>分销规则操作</h5>
            </div>

            <ul class="tab-base nc-row">
                <li>
                    <a href="index.php?act=fenxiao&op=index">
                        <span>会员分销规则</span>
                    </a>
                </li>
                <li>
                    <a href="index.php?act=fenxiao&op=store">
                        <span>小店分销规则</span>
                    </a>
                </li>
                <li>
                    <a href="index.php?act=fenxiao&op=sq">
                        <span>商圈分销规则</span>
                    </a>
                </li>
                <li>
                    <a href="JavaScript:void(0);" class="current">
                        <span>代理分销规则</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
            <span id="explanationZoom" title="收起提示"></span></div>
        <ul>
            <li>在这里可以设置代理之间各层级的分销比例</li>
        </ul>
    </div>
    <form method="post" id="db_form">
        <input type="hidden" name="form_submit" value="ok"/>
        <div class="ncap-form-default">
            <div class="title">
                <h3>市级代理人</h3>
            </div>
            <dl class="row">
                <dt class="tit">地区渠道佣金比例</dt>
                <dd class="opt">
                    <input type="text" id="fx_dl_city" value="<?php echo $output['list_setting']['fx_dl_city']; ?>" name="fx_dl_city" class="w60"> ％
                    <p class="notic">地区渠道佣金 = 商品利润 * 地区渠道佣金比例</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">推荐代理佣金比例</dt>
                <dd class="opt">
                    <input type="text" id="fx_dl_city_invite" value="<?php echo $output['list_setting']['fx_dl_city_invite']; ?>" name="fx_dl_city_invite" class="w60"> ％
                    <p class="notic">直推代理佣金 = 商品利润  * 直推市代佣金比例 </p>
                </dd>
            </dl>
            <div class="title">
                <h3>镇级代理人</h3>
            </div>
            <dl class="row">
                <dt class="tit">地区渠道佣金比例</dt>
                <dd class="opt">
                    <input type="text" id="fx_dl_area" value="<?php echo $output['list_setting']['fx_dl_area']; ?>" name="fx_dl_area" class="w60"> ％
                    <p class="notic">地区渠道佣金 = 商品利润 * 地区渠道佣金比例</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">推荐代理佣金比例</dt>
                <dd class="opt">
                    <input type="text" id="fx_dl_area_invite" value="<?php echo $output['list_setting']['fx_dl_area_invite']; ?>" name="fx_dl_area_invite" class="w60"> ％
                    <p class="notic">直推代理佣金 = 商品利润  * 直推市代佣金比例 </p>
                </dd>
            </dl>
            <div class="title">
                <h3>悦享体验馆</h3>
            </div>
            <dl class="row">
                <dt class="tit">地区渠道佣金比例</dt>
                <dd class="opt">
                    <input type="text" id="fx_dl_ty" value="<?php echo $output['list_setting']['fx_dl_ty']; ?>" name="fx_dl_ty" class="w60"> ％
                    <p class="notic">地区渠道佣金 = 商品利润 * 地区渠道佣金比例</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">推荐体验馆佣金比例</dt>
                <dd class="opt">
                    <input type="text" id="fx_dl_ty_invite" value="<?php echo $output['list_setting']['fx_dl_ty_invite']; ?>" name="fx_dl_ty_invite" class="w60"> ％
                    <p class="notic">直推体验馆佣金 = 商品利润  * 直推体验馆佣金比例 </p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">一级分销佣金比例</dt>
                <dd class="opt">
                    <input type="text" id="fx_dl_ty_one" value="<?php echo $output['list_setting']['fx_dl_ty_one']; ?>" name="fx_dl_ty_one" class="w60"> ％
                    <p class="notic">一级分销佣金 = 商品利润  * 一级分销佣金比例 </p>
                </dd>
            </dl>
            <div class="bot"><a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green"
                                id="btn"><?php echo $lang['nc_submit']; ?></a></div>
        </div>
    </form>
</div>
<script>
    $(document).ready(function () {
        $('#btn').click(function () {
            var fx_dl_city = $("#fx_dl_city").val();
            var fx_dl_area = $("#fx_dl_area").val();
            var fx_dl_area_invite = $("#fx_dl_area_invite").val();
            var fx_dl_city_invite = $("#fx_dl_city_invite").val();
            var fx_dl_ty = $("#fx_dl_ty").val();
            var fx_dl_ty_invite = $("#fx_dl_ty_invite").val();
            var fx_dl_ty_one = $("#fx_dl_ty_one").val();

            if (isNaN(fx_dl_city) || fx_dl_city == 'undefined' || fx_dl_city == '' || fx_dl_city < 0) {
                alert('市代，地区渠道佣金比例必须是不小于0的纯数字');
                return ;
            }
            if (isNaN(fx_dl_city_invite) || fx_dl_city_invite == 'undefined' || fx_dl_city_invite == '' || fx_dl_city_invite < 0) {
                alert('市代，推荐代理佣金比例必须是不小于0的纯数字');
                return ;
            }
            if (isNaN(fx_dl_area) || fx_dl_area == 'undefined' || fx_dl_area == '' || fx_dl_area < 0) {
                alert('镇代，地区渠道佣金比例必须是不小于0的纯数字');
                return ;
            }
            if (isNaN(fx_dl_area_invite) || fx_dl_area_invite == 'undefined' || fx_dl_area_invite == '' || fx_dl_area_invite < 0) {
                alert('镇代，推荐代理佣金比例必须是不小于0的纯数字');
                return ;
            }
            if (isNaN(fx_dl_ty) || fx_dl_ty == 'undefined' || fx_dl_ty == '' || fx_dl_ty < 0) {
                alert('体验馆，地区渠道佣金比例必须是不小于0的纯数字');
                return ;
            }
            if (isNaN(fx_dl_ty_invite) || fx_dl_ty_invite == 'undefined' || fx_dl_ty_invite == '' || fx_dl_ty_invite < 0) {
                alert('体验馆，推荐体验馆佣金比例必须是不小于0的纯数字');
                return ;
            }
            if (isNaN(fx_dl_ty_one) || fx_dl_ty_one == 'undefined' || fx_dl_ty_one == '' || fx_dl_ty_one < 0) {
                alert('体验馆，一级分销佣金比例必须是不小于0的纯数字');
                return ;
            }
            $("#db_form").submit();
        });
    });
</script>